from flask import Flask, jsonify, request, Response
from 二维码生成器 import handler
#运行二维码生成器调用示例，访问本地浏览器访问http://127.0.0.1:5000/qrcode，返回二维码图片。
#需要安装的库：flask,qrcode
app = Flask(__name__)


@app.route('/qrcode', methods=['GET', 'POST'])
def qrcode():
    event = request.json if request.is_json else {}
    context = {}
    response = handler(event, context)
    return Response(response['body'], mimetype=response['headers']['Content-Type'])


if __name__ == '__main__':
    app.run(debug=True)
    # 示例：修改启动脚本中的路径
    app.run(host='127.0.0.1', port=5000)
